
#ifndef CANDRIVER_H_
#define CANDRIVER_H_


#include "include.h"



#define CAN_RX_IO    GPIO_Pin_8
#define CAN_TX_IO    GPIO_Pin_9
#define CAN_PORT     GPIOB
#define CAN_IO_ClockCmd()  do{RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO, ENABLE);  \
                              GPIO_PinRemapConfig(GPIO_Remap1_CAN1, ENABLE);}while(0)
#define CAN_ClockCmd()     do{RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN1,ENABLE);}while(0)   
															

#define CAN_UCPControlSignalCanID     (0x121ul)
#define CAN_UCPControlSignalStartBit  (u8)(0u)		
#define CAN_UCPControlSignalLength    (u8)(1u)			


#define CAN_APTDSignalCanID           (0x202ul)
#define CAN_APTDTxMsgCycle            (u16)(3u)




#define  CAN_StandFRAME                     (0)
#define  CAN_ExtendFRAME                    (1)
#define  CAN_Filter_List                    (0)
#define  CAN_Filter_Mask                    (1)
#define  CAN_Filter_Software                (2)
#define  CAN_Filter_Mask_IrrelevantMode     (0)
#define  CAN_Filter_Mask_MatchMode          (1)


#define  CAN_FRAMETYPE          (CAN_StandFRAME)
#define  CAN_FILTER_MODE        (CAN_Filter_Software)
#define  CAN_FILTER_MASK_MODE   (CAN_Filter_Mask_IrrelevantMode)															

#define  CANID_Number           (u8)(1u)
#define  CAN_Baud               (u16)(500u)
#define  CAN_ClockFreq          (u8)(36u)
typedef enum
{
	IntelFormat = 0,
	MotorolaFormat,
}CAN_SignalFormatType;

#define CAN_SignalFormat     (MotorolaFormat)

extern void Can_Config(void);
extern const u32 u32CanId_Array[];													
#endif






